package com.why.config.proxy;

import io.utown.console.service.constant.ConsoleConst;
import org.mitre.dsmiley.httpproxy.ProxyServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class ProxyServletConfiguration {

    private static final String url = ConsoleConst.path+"/proxy";
    @Bean
    public ServletRegistrationBean<CustomProxyServlet> servletServletRegistrationBean() {
        ServletRegistrationBean<CustomProxyServlet> servletRegistrationBean = new ServletRegistrationBean<>(new CustomProxyServlet(), url);
        servletRegistrationBean.addInitParameter(ProxyServlet.P_LOG, "true");
        return servletRegistrationBean;
    }

}
